Page({
  data: {
    tabbarIndex: 0, //默认显示  tab1
      list: [{
          "text": "对话",
          "iconPath": "/icons/tabbar_icon_chat_default.png",
          "selectedIconPath": "/icons/tabbar_icon_chat_active.png",
           dot: true
      },
      {
          "text": "设置",
          "iconPath": "/icons/tabbar_icon_setting_default.png",
          "selectedIconPath": "/icons/tabbar_icon_setting_active.png",
          badge: 'New'
      }],
      inputShowed: false,
      inputVal: "",


      background: ['https://api-hmugo-web.itheima.net/pyg/banner1.png', 'https://api-hmugo-web.itheima.net/pyg/banner2.png', 'https://api-hmugo-web.itheima.net/pyg/banner3.png'],
      indicatorDots: true,
      vertical: true,
      autoplay: true,
      interval: 2000,
      duration: 500


  },

  
  tabChange(e) {
    let index = e.detail.index;
    this.setData({
      tabbarIndex: index
    })
    console.log('tab change', e.detail.index)
  },
  onLoad() {
    this.setData({
        search: this.search.bind(this)
    })
},
search: function (value) {
    return new Promise((resolve, reject) => {
        setTimeout(() => {
            resolve([{text: '搜索结果', value: 1}, {text: '搜索结果2', value: 2}])
        }, 200)
    })
},
selectResult: function (e) {
    console.log('select result', e.detail)
},
});